<div class="pageContent">
    <table class="table" id="businessFieldTable" width="100%" layoutH="58">
        <thead>
            <tr>
            	<th width="80"><input type="checkbox" name="cbFields" group="codes" class="checkboxCtrl"></th>
                <th width="100"><@label key="businessField.C">业务字段</@label></th>
                <th width="100"><@label key="fieldDescription.C">字段描述</@label></th>                
            </tr>
        </thead>
        <tbody>
        	<tr target="field_code">
            	<td width="80"><div><input name="codes" value="" type="checkbox"></div></td>        
                <td width="100"><div>(占位符)</div></td>
                <td width="100"><div>(占位符)<input name="fieldLabel" type="hidden"></div></td>
            </tr>
            <#if page??><#if (page.data?size>0)> <#list page.data as field>
            <tr>
            	<td><input name="codes" value="${field.businessField!''}" type="checkbox"></td>        
                <td>${field.businessField!''}</td>
                <td>${field.fieldLabel!''}<input name="fieldLabel" value="${field.fieldLabel!''}" type="hidden"></td>
            </tr>
            </#list>
            </#if>
            </#if>
        </tbody>
    </table>
    <div class="formBar">
		<ul>
			<li>
				<div class="buttonActive">
					<div class="buttonContent">
						<button type="button" onclick="okBusinessField()"><@label key="ok.B">确定</@label></button>
					</div>
				</div>
			</li>
			<li>
				<div class="buttonActiveGrey">
					<div class="buttonContent">
						<button type="button" class="close"><@label key="cancel.B">取消</@label></button>
					</div>
				</div>
			</li>
		</ul>
	</div>
</div>
<script type="text/javascript">

    var $onBusinessField = $.pdialog.getCurrent();
    
    function okBusinessField() {    
		var data = "";
		var text = "";
		$('#businessFieldTable').find("tbody tr").each(function(){	
			var tds=$(this).find('td');
			if(tds.eq(0).find("input").attr("checked")){
				var businessField = tds.eq(0).find("input").val();
				if(data=="" && businessField!=""){
					data = businessField;
				}else{
					if(data.charAt(data.length-1)==","){
						data = data + businessField;
					}else{
						data = data +","+businessField;
					};					
				};	
				var businessFieldText = tds.eq(2).find("input").val();				
				if(text=="" && businessFieldText!=""){
					text = businessFieldText;
				}else{
					if(text.charAt(text.length-1)==","){
						text = text + businessFieldText;
					}else{
						text = text +","+businessFieldText;
					};					
				};
			};
	    });	      
        $.pdialog.close($onBusinessField);
        _onBusinessFieldCallback(data,text);
    }
</script>